﻿using System;
using System.Globalization;

public static class StringExtensions
{
    public static string InitCap(this String str)
    {
        var colNameParts = str.Split('_');
        var result = string.Empty;
        foreach (var colNamePart in colNameParts)
        {
                result += colNamePart[0].ToString(CultureInfo.InvariantCulture).ToUpper() +
                                colNamePart.Substring(1, colNamePart.Length-1).ToLower();
        }

        return result;
    }        
}